package com.yc.http.d0704;

public class Cookie {

    private String name;
    private String value;
    private int maxAge = -1;

    private String path;   //路径
    private String domain; // 域名


    public Cookie(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public void setMaxAge(int maxAge) {
        this.maxAge = maxAge;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public String getName() {
        return name;
    }

    public String getValue() {
        return value;
    }

    public int getMaxAge() {
        return maxAge;
    }

    public String getPath() {
        return path;
    }

    public String getDomain() {
        return domain;
    }

    @Override
    public String toString() {
        String ret = name + "=" + value + ";";
        if (maxAge >= 0) {
            ret += " Max-Age=" + maxAge + ";";
        }
        ret += " path=/";
        return ret;
    }
}
